package FALCON;

class Layer {
    public static final int BIAS = 1;

    int H;                 /* - number of units in this layer       */
    double[] Output;          /* - output of ith unit                  */
    double[] dydwx;           /* - error term of ith unit              *///模型中不可测量噪声
    double[][] W;        /* - connection weights to ith unit      */
    double[][] WeightSave;    /* - saved weights for stopped training  */
    double[][] dydw;       /* - last W deltas for momentum     */

    public Layer(int D, int H) {//D->H
        this.H = H;
        this.Output = new double[this.H + 1];
        this.dydwx = new double[this.H + 1];
        this.W = new double[this.H + 1][];
        this.WeightSave = new double[this.H + 1][];
        this.dydw = new double[this.H + 1][];
        //this.Output[H+1] = BIAS;  /* BIAS = 1, like w0 */

        if (D != 0) {
            for (int i = 0; i < this.H; i++) {
                this.W[i] = new double[D + 1];      /* W[0] for what */
                this.WeightSave[i] = new double[D + 1];  /* WeightSave[0] for what */
                this.dydw[i] = new double[D + 1];     /* so dweight is a Unit[l-1]*Unit[l] array */
            }
        }
    }
};
